You can beat the tourist rush by visiting San Francisco in the spring(March to May) , when the weather is mild and hotel prices have yet to rise. Average high temperatures in the mid-60s will certainly keep you from diving in to the Pacific, but you shouldn't have any limitations wandering the city on foot.
Advance booking is the best way to get cheap flight to San Francisco. Book 40 to 25 days in advance to grab cheap flights. Airlines such as US Airways, American Airline, United Airline and Delta Airlines offers great discounts on airline tickets. From the airport you can use bus, the inexpensive way to move around. Taxis and Caltrain service is also available.